package com.biz.primus.ms.promotion.dao.ro;

import com.biz.primus.base.redis.annotation.Ro;
import com.biz.primus.base.redis.bean.BaseRedisObject;
import java.time.LocalDateTime;
import lombok.Getter;
import lombok.Setter;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

/**
 * 活动Ro
 *
 * @author david-liu
 */
@Getter
@Setter
@Ro(key = "pmt:act")
public class ActivityRo extends BaseRedisObject<Long> {
    private static final long serialVersionUID = 2894893478498083180L;

    /**
     * 活动名称
     */
    private String name;

    /**
     * 活动描述
     */
    private String description;

    /**
     * 活动Logo
     */
    private String logo;

    /**
     * 活动开始时间
     */
    private LocalDateTime startTime;

    /**
     * 活动结束时间
     */
    private LocalDateTime endTime;

    /**
     * 活动富文本信息
     */
    private String rawHtml;

    /**
     * 活动状态
     */
    private Integer status;

    public Boolean isActivityInValidPeriod() {
        LocalDateTime n = LocalDateTime.now();
        return startTime.isBefore(n) && endTime.isAfter(n);
    }

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
    }
}
